Component({
  properties: {
    show: {
      type: Boolean,
      value: false
    },
    active: {
      type: String,
      value: ''
    }
  },
  data: {
    types: [
      { label: '国企', value: 1 },
      { label: '股份制', value: 2 },
      { label: '私企/集体', value: 3 },
      { label: '中外合资', value: 4 },
      { label: '外商独资', value: 5 },
      { label: '其他', value: 6 },
    ],
    defaultIndex: 0
  },
  methods: {
    beforeOpen () {
      let index = this.data.types.findIndex(item => item.value === parseInt(this.data.active))
      this.setData({ defaultIndex: index })
    },
    confirm ({ detail: { value } }) {
      this.triggerEvent('confirm', value)
    },
    cancel () {
      this.triggerEvent('close')
    }
  },
})